package com.iot.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.iot.service.DataDockingService;

@Service
public class Schedule {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private DataDockingService dataDockingService;
	
	@Scheduled(cron = "${maijie.data.task.cron:-}")
	private void getRealData() {
		logger.info("******定时任务-获取实时数据开始******");
		try {
			dataDockingService.getRealData();
		} catch (Exception e) {
			logger.error("******定时任务-获取实时数据异常******", e);
		}
		logger.info("******定时任务-获取实时数据结束******");
	}
}